package org.xxpay.pay.channel.xinanpay;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.Assert;
import org.xxpay.common.unify.AbstractPaymentConfig;

public class XinanpayConfig extends AbstractPaymentConfig {
    public static final String CHANNEL_NAME = "xinanpay";
    public static final String CHANMEL_NAME_QUICK = CHANNEL_NAME + "_quick";

    public static final String RETURN_VALUE_SUCCESS = "SUCCESS";
    public static final String RETURN_VALUE_FAIL = "0"; // 失败返回码
    public static final String RESPONSE_RESULT_SUCCESS = "success"; // 返回上游成功
    public static final String RESPONSE_RESULT_OK = "SUCCESS"; // 返回上游成功
    public static final String RESPONSE_RESULT_FAIL = "fail";       // 返回上游失败

    public static final String ORDER_STATUS_SUCCESS = "SUCCESS";
    public static final String ORDER_PAY_STATUS_SUCCESS = "1";

    public static final String REQ_PAY_URL_FIXX = ":90/kakaloan/quick/cashierOrder";
    public static final String REQ_PAY_QUERY_URL_FIXX = ":90/kakaloan/api/quickpay/ordertype";

    public static final String REQ_TRANS_URL_FIXX = ":91/Home/OpenAcc/distill";
    public static final String REQ_TRANS_QUERY_URL_FIXX = ":91/Home/OpenAcc/qry";

    XinanpayConfig(String payParam){
        Assert.notNull(payParam, "init quanmin config error");
        JSONObject object = JSON.parseObject(payParam);
        setAppId(object.getString("appId"));
        setMchId(object.getString("mchId"));
        setPrivateKey(object.getString("privateKey"));
        setRequestUrl(object.getString("requestUrl"));
        setPublicKey(object.getString("publickey"));
    }
}
